{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 504x288 with 1 Axes>",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAb4AAAEeCAYAAAD1kXAHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deZwcdZ3/8dc7k4tI5EjClcMJkI0gIQFGxAVjAIHAQvJjQQgiC/uDDSJncLl+y6KA4qJgXCAKUdmoGxMjCEYIh1zLIWiiJC6HkRgCGRASwo3k5PP7o2piZ9Iz0510V/dMvZ+PRz9muurbVe/p7ulPV9W36quIwMzMLC+61TqAmZlZllz4zMwsV1z4zMwsV1z4zMwsV1z4zMwsV7rXOsDm6t+/fzQ2NtY6hpmZ1ZHf/e53r0XEgGLzOn3ha2xsZN68ebWOYWZmdUTSC23N865OMzPLFRc+MzPLFRc+MzPLlU5/jK+YNWvW0NzczMqVK2sdpW717t2bQYMG0aNHj1pHMTPLVJcsfM3NzfTt25fGxkYk1TpO3YkIVqxYQXNzM0OHDq11HDOzTHXJXZ0rV66kX79+LnptkES/fv28RWxmudQlCx/gotcBPz9mllddtvCZmZkVk4vCJ1X2VoqGhgZGjRrFHnvswVFHHcWbb765wfyxY8fy0ksvAbB8+XJ69OjBTTfdtEGbxsZGRowYwahRoxg1ahTnnHPO+nlr166lf//+XHLJJRs8ZsyYMQwfPpyRI0ey//77s3Dhwk14xszMuq5cFL5a2GKLLZg/fz5PPfUU2267LVOmTFk/7/333+f1119n4MCBAPzsZz9jv/32Y8aMGRst58EHH2T+/PnMnz+f6667bv30e++9l+HDhzNr1ixaDyY8ffp0FixYwMknn8wFF1xQpb/QzKxzyrTwSbpZ0jJJT3XQ7uOS1kk6Nqts1fTJT35y/dYdwEMPPcSYMWPW358xYwbXXnstzc3NG7Rrz4wZMzj33HMZMmQITzzxRNE2o0ePZtGiRZuV3cysq8l6i28aMLa9BpIagKuBe7IIVG3r1q3j/vvvZ9y4ceun3XXXXYwdmzwNS5cu5ZVXXmHffffluOOO46c//ekGjz/wwAPX7+qcPHkykGwx3n///Rx55JGccMIJRbcUAX75y18yYsSIKv1lZmadU6aFLyIeBl7voNnZwK3Asuonqp7333+fUaNG0a9fP15//XUOOeSQ9fMee+wxDjjgAABmzpzJcccdB8CECRM2KmKFuzonTZoEwB133MGBBx5Inz59OOaYY7jttttYt27d+seceOKJjBo1iscee4xrrrmm2n+qmVmnUlfH+CQNBI4Gbuyg3URJ8yTNW758eTbhytRyjO+FF15g9erV64/xLV68mMGDB9OzZ08g2WU5bdo0GhsbGTduHAsWLOC5555rd9kzZszgvvvuo7GxkX322YcVK1bw4IMPrp8/ffp05s+fz+23387gwYOr90eamXVCdVX4gG8DF0XEuvYaRcTUiGiKiKYBA4oOt1Q3ttpqK6677jquueYa1qxZs8FuzoULF/Lee+/x0ksvsWTJEpYsWcIll1zCzJkz21ze22+/zaOPPsqLL764/jFTpkxpc3enmZltqN4uWdYEzExPru4PHCFpbUTcvjkLbdXpMXN77bUXI0eOZObMmdx9991cf/31QLLldvTRR2/Q9phjjmHChAn8+7//O5Ac42toaABgzz335KCDDuKggw6iV69e6x8zfvx4LrzwQlatWpXRX2Rm1nmpdVf4qq9QagTuiIg9Omg3LW13S3vtmpqaovVAtM8++yy77bbb5gWtglWrVrH//vvXzcC59fo8mZltLkm/i4imYvMy3eKTNAMYA/SX1Ax8GegBEBHtHtfrCnr16lU3Rc/MLK8yLXwRcUIZbU+pYhQzM8upeuvcYmZmVlUufGZmlisufGZmlisufGZmliv1dh5fVVz+s8ou78uf7bhNQ0MDI0aMYM2aNXTv3p2TTz6Z8847j27d/vZdY5999uHxxx+nZ8+ePPnkk+y9997cfffdHHbYYRstp8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LtIDlxfFBELap2nRfom7xcRy2qdBUDSRGBOuqWwG0DaoaTmJPWPiNdqnQNA0giSgrwryZeq5oh4o1ZfWlplq1mxa01Jt/yDSYreFelxY0sVfFZ+EBGrJPUE/hG4hOT9NRO4n2QPzMCIuLSi63fh69okbUnaiSki3q5xnKLq4UOzM6inD3YrTz2+x+spk6RvkBxrvA24ICIWt+RLD9k8GhEV6/TmY3xd33v18uZuS73nqxcuep1Py4d3Pb7Ha52poLD9P5LDC+MiYn2nn4Iep58Gbqnkul34urhav7nN8sz/f21LC1tvYAfgzMJj6umhkL2AU0n6JzxXyXW78JmZWa0MI+n1Xlj0hgCjgbNIzoE8t9IrdeEzM7OaSE+1WJaeutMb2I3knMxDgV+RXBT9L5Verzu3mJlZzUgaDPwDycUtFpIUwBtbOrNUo1OXC5+ZmdWFwqu2tFyyrBrHSV34zMysrlT7VAsXPjMzyxWPzmBmZrniwmdmZrniwmdmZrniwmdmZrniwmdmZrniwmdmZrniwmdmZrny/wG8+wt6uMUf1wAAAABJRU5ErkJggg==\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import csv\n",
    "%matplotlib inline\n",
    "import numpy as np\n",
    "import os\n",
    "import re\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.ticker as ticker\n",
    "\n",
    "DIR_NAME = './solutions/'\n",
    "FIG_SIZE = (7, 4)  # height * width\n",
    "BAR_WIDTH = 0.2  # width of bar\n",
    "fontdict = {'family': 'Times New Roman', 'weight': 'normal', 'size':15}\n",
    "colors = {\n",
    "    'R/AEAP': 'blue', 'R/AEAP-BF': 'green', 'R/AEAP-WF': 'red',\n",
    "    'D/AEAP': '#80aaff', 'd-aeapbf': 'green', 'd-aeapwf': 'red',\n",
    "    'ILS': '#999999',\n",
    "}\n",
    "\n",
    "filenames = os.listdir(DIR_NAME)\n",
    "filenames_dict = {\n",
    "    'R/AEAP': [],\n",
    "    'D/AEAP': [],\n",
    "    'ILS': []\n",
    "}\n",
    "\n",
    "for filename in filenames:\n",
    "    if re.match(r'b.*backtracking.*aeap\\.csv', filename):\n",
    "        filenames_dict['R/AEAP'].append(filename)\n",
    "    elif re.match(r'b.*dijkstra.*aeap\\.csv', filename):\n",
    "        filenames_dict['D/AEAP'].append(filename)\n",
    "    elif re.match(r'o.*backtracking.*aeap\\.csv', filename):  # only care about R/AEAP\n",
    "        filenames_dict['ILS'].append(filename)\n",
    "\n",
    "fig, ax = plt.subplots(figsize=FIG_SIZE)\n",
    "ax.set_title('')\n",
    "labels = ['flow-{}'.format(i) for i in range(1, 20)]  # flows no.\n",
    "x = np.arange(len(labels))\n",
    "\n",
    "i = 0\n",
    "for alias, filenames in filenames_dict.items():\n",
    "    filename = filenames[0]  # take first file\n",
    "    y = []\n",
    "    with open(os.path.join(DIR_NAME, filename), 'r') as file:\n",
    "        reader = csv.reader(file)\n",
    "        for line in reader:\n",
    "            y.append(round(100 - float(line[0]) * 100, 4))  # reliability\n",
    "    x = x[:10]\n",
    "    y = y[:10]\n",
    "    if i < 1:\n",
    "        ax.bar(x - BAR_WIDTH, y, width=BAR_WIDTH, label=alias, color=colors[alias])\n",
    "    elif i == 1:\n",
    "        ax.bar(x, y, width=BAR_WIDTH, label=alias, color=colors[alias])\n",
    "    else:\n",
    "        ax.bar(x + BAR_WIDTH, y, width=BAR_WIDTH, label=alias, color=colors[alias])\n",
    "    i += 1\n",
    "plt.xticks(rotation=-60)\n",
    "ax.legend()\n",
    "ax.set_ylabel('Pkt. loss rate (%)', fontdict=fontdict)\n",
    "ax.set_ylim(ymax=1.5)\n",
    "ax.set_xticks(x)\n",
    "labels = labels[:10]\n",
    "ax.set_xticklabels(labels, fontdict=fontdict)\n",
    "fig.savefig('./fig_reliability.png', dpi=300, bbox_inches = \"tight\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}